package com.gxd.base.entity;

import java.util.List;
import java.util.Map;

/***
 * 分页工具类
 */
public class Page {
	
	private int pageSize = 5;// 页显示条数
	private int currentPage;// 当前页码
	private int totalSize;// 总记录条数
	private int totalPage;// 总页数
	private int beginSize;// 开始查询记录条数
	private int endSize;// 结束查询记录条数
	private List<Map<String, Object>> list;// 记录
	
	public Page(){}
	public Page(int currentPage){
		this.currentPage = currentPage;
	}
	
	public int getPageSize() {
		return pageSize;
	}
	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}
	public int getCurrentPage() {
		return currentPage;
	}
	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
	}
	public int getTotalSize() {
		return totalSize;
	}
	public void setTotalSize(int totalSize) {
		this.totalSize = totalSize;
	}
	public int getTotalPage() {
		int totalSize = getTotalSize();
		return (int) (totalSize%pageSize==0?(totalSize/pageSize):(totalSize/pageSize+1));
	}
	public void setTotalPage(int totalPage) {
		this.totalPage = totalPage;
	}
	public List<Map<String, Object>> getList() {
		return list;
	}
	public void setList(List<Map<String, Object>> list) {
		this.list = list;
	}
	public int getBeginSize() {
		return beginSize = currentPage>0?(currentPage-1) * pageSize + 1:0;
	}
	public void setBeginSize(int beginSize) {
		this.beginSize = beginSize;
	}
	public int getEndSize() {
		int beginSize = getBeginSize();
		return beginSize + pageSize - (beginSize>0?1:0);
	}
	public void setEndSize(int endSize) {
		this.endSize = endSize;
	}
	
}